import {createRouter, createWebHashHistory} from "vue-router";
import Home from "../components/home.vue";
import Main from "../components/main.vue";
import First from "../components/first.vue";
import Generator from "../components/generator.vue";
import Exception from "../components/exception.vue";
import Test from "../components/test.vue";
import Test02 from "../components/test02.vue";
import Test03 from "../components/test03.vue";

const routes = [
    {
        path: "/",
        redirect:"/main/first"
    },
    {
        path: "/:catchAll(.*)", // 不识别的path自动匹配404
        redirect: '/exception',
    },
    {
        path:"/main",
        name:"name",
        component: Home,
        children: [
            {
                path:"table",
                name:"table",
                component: Main
            },
            {
                path:"first",
                name: "first",
                component: First
            },
            {
                path: "generator",
                name: "generator",
                component: Generator
            }
        ]
    },
    {
        path: "/exception",
        name: "404",
        component: Exception
    },
    {
        name: "/test",
        path: "/test",
        component: Test
    },
    {
        name: "/test02",
        path: "/test02",
        component: Test02
    },
    {
        name: "/test03",
        path: "/test03",
        component: Test03
    },
];
export const router = createRouter({
    history: createWebHashHistory(),
    routes: routes
})